<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
    <head>
        <th:block th:include="include :: header('修改学科')"/>
    </head>
    <body class="white-bg">
        <div class="wrapper wrapper-content animated fadeInRight ibox-content">
            <form class="form-horizontal m" id="form-manage-edit" th:object="${bizSubject}">
                <input name="id" th:field="*{id}" type="hidden">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">学科名称：</label>
                    <div class="col-sm-8">
                        <input name="subjectName" th:field="*{subjectName}" class="form-control" type="text" required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">名称首字母：</label>
                    <div class="col-sm-8">
                        <input name="initialLetter" th:field="*{initialLetter}" class="form-control" type="text">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">名称全拼音：</label>
                    <div class="col-sm-8">
                        <input name="fullLetter" th:field="*{fullLetter}" class="form-control" type="text">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">所属学科：</label>
                    <div class="col-sm-8">
                        <div class="input-group">
                            <input id="treeId" name="parentId" type="hidden" th:field="*{parentId}"/>
                            <input class="form-control" type="text" onclick="selectManageTree()" id="treeName"
                                   readonly="true" th:field="*{parentName}">
                            <span class="input-group-addon"><i class="fa fa-search"></i></span>
                        </div>
                    </div>
                </div>
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-3 control-label">显示顺序：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <input name="orderNum" th:field="*{orderNum}" class="form-control" type="text">-->
<!--                    </div>-->
<!--                </div>-->
                <div class="form-group">
                    <label class="col-sm-3 control-label">学科状态：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" >
                            <input type="radio" name="visible" value="0" th:field="*{visible}">
                            <label>显示</label>
                        </div>
                        <div class="radio-box" >
                            <input type="radio" name="visible" value="1" th:field="*{visible}">
                            <label>隐藏</label>
                        </div>
                    </div>
                </div>

            </form>
        </div>
        <th:block th:include="include :: footer"/>
        <script type="text/javascript">
            var prefix = ctx + "biz/subject";
            $("#form-manage-edit").validate({
                                                focusCleanup: true
                                            });

            function submitHandler() {
                if ($.validate.form()) {
                    $.operate.save(prefix + "/edit", $('#form-manage-edit').serialize());
                }
            }

            /*学科管理-新增-选择父部门树*/
            function selectManageTree() {
                var options = {
                    title: '学科管理选择',
                    width: "380",
                    url: prefix + "/selectManageTree/" + $("#treeId").val(),
                    callBack: doSubmit
                };
                $.modal.openOptions(options);
            }

            function doSubmit(index, layero) {
                var tree = layero.find("iframe")[0].contentWindow.$._tree;
                if ($.tree.notAllowLastLevel(tree)) {
                    var body = layer.getChildFrame('body', index);
                    $("#treeId").val(body.find('#treeId').val());
                    $("#treeName").val(body.find('#treeName').val());
                    layer.close(index);
                }
            }
        </script>
    </body>
</html>